package gz.metro.datasync.config;

import gz.metro.datasync.service.DataClientService;
import gz.metro.datasync.utils.JdbcHelper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import javax.sql.DataSource;

/**
 * @author ：张任豪
 * @date ：2022/10/13 9:55
 * @description：
 */

@Configuration
@PropertySource(value= "classpath:datasync.properties")
public class AppConfig {

    @Value("${uuap.serverPath}")
    private String serverPath;
    @Value("${uuap.appCode}")
    private String appToken;

    @Bean
    public JdbcHelper jdbcHelper(DataSource dataSource)
    {
        return new JdbcHelper(dataSource);
    }

    @Bean
    public DataClientService dataClientService(){
        DataClientService dataClientService = new DataClientService();
        dataClientService.setAppToken(appToken);
        dataClientService.setServerPath(serverPath);
        return dataClientService;
    }



}
